1. Field of the Invention
The invention relates to processing of packets. More specifically, the invention relates to a method and an apparatus for determining from a frame, one or more attributes (e.g. VLAN tag) that are at different locations in the frame depending on the type of encapsulation, and use of one or more such attributes to create a key as specified by a user and use of the key to identify instructions to be executed also specified by the user.
2. Related Art
U.S. Pat. No. 6,587,463 that is incorporated by reference herein in its entirety describes packet classification by use of a rule memory and a criterion memory. Control logic responds to packet classification requests by retrieving from rule memory an operator and a pointer to an entry in criterion memory. The operator defines a comparison operation to be performed between comparands from criterion memory and corresponding values from a received packet. The results are provided to a packet processor to take an appropriate action.
U.S. Pat. No. 6,598,034 that is also incorporated by reference herein in its entirety describes a set of rules that are developed and stored for use by a Just-In-Time (JIT) compiler, a run-time compiler or the like. The rules establish a set of patterns, and the incoming data is compared to those patterns. If certain patterns are detected, then the associated action established by the rule is applied to the processing of the data packet.
U.S. Pat. No. 6,718,326 which is incorporated by reference herein in its entirety describes use of a CAM which has a limited bit width to search rules of packet classification having very long search bit width. The fields of rules of packet classification are grouped into groups, and the grouped fields of each rule are stored along with search related information (except for the initial group) and number of search information in a CAM.
Certain prior art network processors may be programmed, in software, to process packets that are encapsulated in frames whose headers have formats of the type shown in FIGS. 1A-1G, which are as follows:                FIG. 1A—Ethernet v2 untagged        FIG. 1B—802.3 untagged        FIG. 1C—SNAP untagged        FIG. 1D—Ethernet v2 with 1 VLAN tag        FIG. 1E—Ethernet v2 with 2 VLAN tags        FIG. 1F—SNAP with 1 VLAN tag        FIG. 1G—SNAP with 2 VLAN tagsTo handle packets that are encapsulated in frames of multiple formats, it is common for a prior art network processor to be programmed, by the user, to contain a rule for each of the above-listed seven encapsulations (FIGS. 1A-1G). Specifically, the user is required to have knowledge of the format of the above-listed seven encapsulations and to repeatedly perform the programming, once for each encapsulation.        